﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ATEC.ATDataCoreNET;
using ATEC.GeometryNET;
using DoModelExample;
using System.IO;
using System.Windows.Forms;
namespace DoDrawExample
{
   public class Drawing
    {
        /// <summary>
        /// 绘制
        /// </summary>
        public static void DoDraw()
        {
            //定义出图文件名
            string projectFilePath = Path.GetDirectoryName(CreateNewProject.GetDBName());
            string filePath = projectFilePath+"/出图.db";
            //创建出图db
            DrawingFile.CreateDrawingFile(filePath);
            //打开出图文件
            ATProject project = DrawingFile.OpenATProject(filePath, ATProjectOpenMode.ReadWrite);
            //添加图框
            DrawingFile.AddFrame(XPoint2d.FromXY(0, 0), project);
            //绘制轮廓
            DrawingProject.DrawProfile(project);
            //刷新左树栏
            DrawingProject.RefreshTreeNode(TreeManager.pRoot);
            //保存
            project.ProcessChanges(ATSaveReason.FileClose);
        }
    }
}
